<%@page import="java.util.Date"%>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/WEB-INF/views/include.inc.jsp"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
<script type="text/javascript">
$(function()
		{
			$("#permissionOperator").find("a").click(function()
					{
						
							var url="${ctx}/permission/";
							if(this.className=='add')
							{
								if('${moduleId}'!='')
								{
									url=url+"preCreate/${moduleId}";
									$.pdialog.open(url, "oo", "新增权限清单",'options:{width:100px,height:100px,max:true,mask:true,mixable:true,minable:true,resizable:true,drawable:true,fresh:true,close:”function”, param:”{msg:’message’}”}');
								}
								else
									alertMsg.error("请选择组件");
							}
								
	
						
					});
		});
</script>
</head>
<div class="pageContent" id="selectModuleDiv">
	<div class="pageHeader">
		<div class="searchBar">
		<div class="panelBar">
			<ul class="toolBar">
				<li>
				<input type="text" name="keywords" value="${moduleName }" id='selectedModule' readonly/>
				<%-- <input type="text" name="keywords" value="${moduleId }" id='selectedModuleId' onchange="alert('changed')" target="slt_mid" rel="xxx" readonly/> --%>
				</li>
				<li>
					<a class="add" target="dialog" mask="true" width="500" height="500"  href="${ctx}/permission/getModulesTree"><span>选择组件</span></a>
				</li>
			</ul>
		</div>
			<div class="subBar">
			</div>
		</div>
	</div>
<form id="pagerForm" method="post" action="${ctx}/permission/list?moduleId=${moduleId }">
	<input type="hidden" name="pageNum" value="${page.pageNum}" />
	<input type="hidden" name="numPerPage" value="${page.numPerPage}" /> 
	<input type="hidden" name="orderField" value="${page.orderField}" />
	<input type="hidden" name="orderDirection" value="${page.orderDirection}" />
	 
	<input type="hidden" name="keywords" value="${moduleId }"/>
</form>
	<div class="panelBar" id="permissionOperator">
		<ul class="toolBar">
			<shiro:hasPermission name="User:save">
				<li><a class="add"><span>添加</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="User:edit">
				<li><a class="edit" target="dialog"  mask="true" width="530" height="380" href="${ctx}/permission/preUpdate/{slt_pid}" ><span>编辑</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="User:delete">
				<li><a class="delete" target="ajaxTodo"  ref="selectModuleDiv" href="${ctx}/permission/delete/{slt_pid}" title="确认要删除该权限清单?"><span>删除</span></a></li>
			</shiro:hasPermission>
		</ul>
	</div>
	<table class="table" layoutH="138" width="100%">
		<thead>
			<tr>
				<th width="100">权限名称</th>
				<th width="100">所属模块</th>
				<th width="200">权限描述</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="item" items="${plist}">
			<tr target="slt_pid" rel="${item.id}">
				<td>${item.strName}</td>
				<td>${item.program.strName}</td>
				<td>${item.strDesc}</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	
	<!-- 分页 -->
	<c:import url="/WEB-INF/views/pager/panelBar.jsp"></c:import>
	
</div>
